import Vue from 'vue'
import VueRouter from 'vue-router'

import LayoutView from '@/layout/index.vue'
import editArticle from '@/views/editArticle/index.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Layout',
    component: LayoutView,
    // redirect: '/home',
    children: [
      {
        path: '/article',
        name: 'ArticleManage',
        component: () => import('@/views/article/index.vue'),
        meta: { title: '文章管理' }
      }
    ]
  },
  {
    path: '/edit',
    name: 'Edit',
    component: editArticle,
  },
  {
    path: '/mobile',
    component: () => import('@/views/Mobile/index.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

// router.beforeEach((to, from, next) => {
//   if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
//     window.location.href = '/move.html/'
//     return
//   }
//   next()
// })

export default router
